package org.come.control;

import com.tool.ModerateTask.TaskRoleData;
import org.come.Frame.DreamlandTrialMainJframe;
import org.come.Jpanel.DreamlandTrialMainJpanel;
import org.come.action.FromServerAction;
import org.come.shortcut.XBjczJpanel;
import org.come.shortcut.XBjczJpanelxsjm;
import org.come.until.GsonUtil;

import come.tool.Fighting.FightingMixDeal;
import come.tool.FightingData.BattleEnd;
import come.tool.handle.HandleState;

public class BattleEndControl implements FromServerAction{

	private int fber=0;
	@Override
	public void controlMessFromServer(String mes,String type) {
		// TODO Auto-generated method stub
		BattleEnd battleEnd=GsonUtil.getGsonUtil().getgson().fromJson(mes,BattleEnd.class);
		if (FightingMixDeal.FightingNumber!=battleEnd.getFightingNumber()||FightingMixDeal.FightingNumber==-1) {
            return;
        }
		if (fber==battleEnd.getFightingNumber()) {return;}
		fber=battleEnd.getFightingNumber();

		//增加幻境挑战成功 提升层数
		if(mes.contains("幻境试炼挑战成功")){
			try{
				DreamlandTrialMainJpanel dreamlandTrialMainJpanel = DreamlandTrialMainJframe.getDreamlandTrialMainJframe().getDreamlandTrialMainJpanel();
				dreamlandTrialMainJpanel.setNowLvl(dreamlandTrialMainJpanel.getNowLvl()+1);
			//	dreamlandTrialMainJpanel.showLvlTier(dreamlandTrialMainJpanel.getNowLvl());
				XBjczJpanelxsjm.getXBjczJpanelxsjm().getXBjczJpanel().getXBjczJpanelzr().getChildAttributeJpanel().showLvlTier(1);
			}catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		//快速结束播放
//		while (FightingMixDeal.State==HandleState.HANDLE_PLAY) {
//			FightingMixDeal.PalyProgress(36);
//		}
		FightingMixDeal.FightingEnd(battleEnd);
	}

}
